UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AEJPNzIPjChnu5dINolq4kTYwHUOrloi27fv+/pnNqE=' 
WHERE 
  key_id = '000593ff71d51c776b0fca8422bcf1ad1c5e4c01728260ce49d21cd961b5b4be' 
  AND (
    token = 'AEJPNzIPjChnu5dINolq4kTYwHUOrloi27fv+/pnNqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060