UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZMlj9TmV/jDoZt56Kzlqd95zo2lY8cGhkYf7nvsGKgM=' 
WHERE 
  key_id = 'b991b639aa6a5bb2e6cf44f57e1978544ab1bee923169f8518868f5fa3e52c84' 
  AND (
    token = 'ZMlj9TmV/jDoZt56Kzlqd95zo2lY8cGhkYf7nvsGKgM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040