UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zIo0YlJTXjjBZUj9+U0emdNYb1KOE+MKKeJOsRAo14E=' 
WHERE 
  key_id = '31a93ddd3cf833365a7a7de66eb56129293a60bfae9e265e86ecc336ea96a894' 
  AND (
    token = 'zIo0YlJTXjjBZUj9+U0emdNYb1KOE+MKKeJOsRAo14E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017