UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3l5TCT9GEaY7UbH+AHYtqss98zWl63g8Lk23NVJhSO8=' 
WHERE 
  key_id = '439cf3e1a62042cb328d1ad387e987adcb7ae66272c061bdbb2d897139ed326e' 
  AND (
    token = '3l5TCT9GEaY7UbH+AHYtqss98zWl63g8Lk23NVJhSO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037