UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YMxxH88ROW+9o940A4hV4h6LThCnA/Egua5ByVqeJUk=' 
WHERE 
  key_id = '7e536a8b84c5772dd6c1330eb8c82b4386cf9a1e42722487611c2da3123d67d7' 
  AND (
    token = 'YMxxH88ROW+9o940A4hV4h6LThCnA/Egua5ByVqeJUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045