UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0IVsv6TQny6xkWDysOtm+QscgqThEMojhNaznNyNXDc=' 
WHERE 
  key_id = '3db39bd8da8f9fcd1f3708808d8a7df9261347ebf0fc52290445fefbaea4e024' 
  AND (
    token = '0IVsv6TQny6xkWDysOtm+QscgqThEMojhNaznNyNXDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042