UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TB3qfqU/u0Z/mCS18P68qOA1lXUC7NMk1IQZCDbhOtA=' 
WHERE 
  key_id = '03758d5d343d86d949a18fbc9e71a1830b411108a85dc6c9d7a7b9ba7a77247d' 
  AND (
    token = 'TB3qfqU/u0Z/mCS18P68qOA1lXUC7NMk1IQZCDbhOtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032