UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LG6/WH/5pLLjQTQJnxjnbKhqzluLF2dxHIeqOtUNPso=' 
WHERE 
  key_id = '998e30b90e54551980f59df889cc8e044cfc9b6c0eed91f68dc8d9ca0b03c417' 
  AND (
    token = 'LG6/WH/5pLLjQTQJnxjnbKhqzluLF2dxHIeqOtUNPso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031