UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JDB+sY3mDivfby8bVYo0DLEsF2geIyiAatDr9wdHo5w=' 
WHERE 
  key_id = '8a6abb2a541ecb94774289cab781bb377532cb3d2626550fbb445c5f36da6d84' 
  AND (
    token = 'JDB+sY3mDivfby8bVYo0DLEsF2geIyiAatDr9wdHo5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046