UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wj8oga8aLp9hqJHkhsV0l7X4/5pbOmo0IwiSIfr8cio=' 
WHERE 
  key_id = 'daedeceb333c636057d01e6665c1ca007e0a1cf9137de70f18bc3e8ac2ea66de' 
  AND (
    token = 'wj8oga8aLp9hqJHkhsV0l7X4/5pbOmo0IwiSIfr8cio=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027