UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oY3MamBi6cBLSXc4PcJZRpFROVdjqncsgdwXcJ+/hrw=' 
WHERE 
  key_id = '8c5c9e91c0d231609222e24802527bfdeeaf4c9dd022a3ce384b3543acbc797d' 
  AND (
    token = 'oY3MamBi6cBLSXc4PcJZRpFROVdjqncsgdwXcJ+/hrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046