UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BSHlZziajehy219rcZN5mywfFE8ADaZE8RTLWs5EJFM=' 
WHERE 
  key_id = 'd41894e3295b6e03f19fe4ef910c0506e7b0635646997c01c930c67f5a887427' 
  AND (
    token = 'BSHlZziajehy219rcZN5mywfFE8ADaZE8RTLWs5EJFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040