UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4pM6DSLS6sxp9fpc3GatPmGD7jvzaKQBhQtDgynFT3Y=' 
WHERE 
  key_id = '7fa68edbb45b0fed821878788caeae71f0743370ce316be62a9a665bc9de686b' 
  AND (
    token = '4pM6DSLS6sxp9fpc3GatPmGD7jvzaKQBhQtDgynFT3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021