UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dy9enVVtCxhNM2AGnCVRJ9El27CF+u8J9gvfgqA6Ovw=' 
WHERE 
  key_id = '48f597501809b12f1000db4e40288dfe323725ba9be2c4edcb30dd90168b93e8' 
  AND (
    token = 'Dy9enVVtCxhNM2AGnCVRJ9El27CF+u8J9gvfgqA6Ovw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054