UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fBTaGMcH1cig+AJELDiEA6z9usQyGvsH1uOvkXlBXlc=' 
WHERE 
  key_id = '3c709dff60d1cc36b06c276eba1354a9f9789a48d0127ea8d1e731bf69df3dd9' 
  AND (
    token = 'fBTaGMcH1cig+AJELDiEA6z9usQyGvsH1uOvkXlBXlc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035