UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3aEr8snyvwvKMtsEdhCS4XwD8CD5z2m9mlMV/RhA+as=' 
WHERE 
  key_id = '7b20fda3146d27132e39268605f37a9db05e2e7a930efe8e0e385df66b488738' 
  AND (
    token = '3aEr8snyvwvKMtsEdhCS4XwD8CD5z2m9mlMV/RhA+as=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030