UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R/1PxnB5jkUevHT73N9tNKMRn7TllShzRmJUKvEs0XA=' 
WHERE 
  key_id = '7e57d9c4209b988d8f83fa5b949cf135e947455e9b7bee20c0803d3622b6ea14' 
  AND (
    token = 'R/1PxnB5jkUevHT73N9tNKMRn7TllShzRmJUKvEs0XA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030