UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CSImO8JMiFBW6l4ThMq8EQjTV9hQZCghBBp+RCXICjw=' 
WHERE 
  key_id = '433e9c15d3a67345f540201c59915b81606f6ed38f27f24541eb02fe2021538f' 
  AND (
    token = 'CSImO8JMiFBW6l4ThMq8EQjTV9hQZCghBBp+RCXICjw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031