UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qFmmysepisoJDcpGR+i7W7aNEU2aSlBIQj9Cbgdvo9M=' 
WHERE 
  key_id = '3fd0e6f40145fb0b7fa6320f1ef91ecfbd783714b15a7e852af3a795a6862db3' 
  AND (
    token = 'qFmmysepisoJDcpGR+i7W7aNEU2aSlBIQj9Cbgdvo9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042