UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BHvb4OBw3TkdxdYinF4evXZruwRq8rT4a+5PLgSA9QQ=' 
WHERE 
  key_id = '171d6d02a962027780414ff6dfe5f904713c4eeaa311d1c19ccf398073f9cab1' 
  AND (
    token = 'BHvb4OBw3TkdxdYinF4evXZruwRq8rT4a+5PLgSA9QQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037