UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4wqM8yClDWMNzSkWUcnAqasad6F/g2jYjXkw9euxg9U=' 
WHERE 
  key_id = 'f00e49541d73cace7fb6b614401d75ac90c0790de39d760a8cda1e2479c25f0e' 
  AND (
    token = '4wqM8yClDWMNzSkWUcnAqasad6F/g2jYjXkw9euxg9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037