UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oTBDQTjDyxX/sUzLgzdXKBHbx18aNfZRaWjnxDcqrYw=' 
WHERE 
  key_id = '23b7f40255dfcf28e17422696a8f59e09615bf84118e846a781eb572d44cb2b9' 
  AND (
    token = 'oTBDQTjDyxX/sUzLgzdXKBHbx18aNfZRaWjnxDcqrYw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032