UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XI0tw/msW3wlS7e3zoNfRYJgGe7/cH0M1nFSvVSfmmM=' 
WHERE 
  key_id = 'ed464efdc1632bf609b5adba93c64e36dc8621bc73f0c64099ce14fcd3a43293' 
  AND (
    token = 'XI0tw/msW3wlS7e3zoNfRYJgGe7/cH0M1nFSvVSfmmM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024