UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fj4KrzF44xESr7d+7SpbQUCPpThb+zdnBlCNe6dx8SI=' 
WHERE 
  key_id = 'cea10391740b8f3a7b8e2da7cfe7f74088dbf0cbeee4bf565d8cb6db83651982' 
  AND (
    token = 'fj4KrzF44xESr7d+7SpbQUCPpThb+zdnBlCNe6dx8SI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00123