UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4xltgIlp6NV+edfSd/vZ6fAZlAwj056oahh0e9y4zS4=' 
WHERE 
  key_id = '71fb0c9a94974a853f43b7b7966133ec70d85701569057bcd7482593976369dd' 
  AND (
    token = '4xltgIlp6NV+edfSd/vZ6fAZlAwj056oahh0e9y4zS4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033