UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NYBzslEf+56BGcT+n9a5jQDbRUH2HKAo+IL2L5ONSHk=' 
WHERE 
  key_id = '7aee210e3b8a2643b813e0760b08b408ea8887449300f574b455c7524d41a469' 
  AND (
    token = 'NYBzslEf+56BGcT+n9a5jQDbRUH2HKAo+IL2L5ONSHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035