UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xoR1Ppt4QE+RlY01geB1zzy3GCgFUeDMZ0pZq5cXizA=' 
WHERE 
  key_id = '9a21e912664eb7a04a1683c8125fb14c4f09b9a60c671118c50dd034822d8627' 
  AND (
    token = 'xoR1Ppt4QE+RlY01geB1zzy3GCgFUeDMZ0pZq5cXizA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034