UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fFc/0SGMxp9tmbBKcuuM2vrztczGgm6jVS3JX7x2txw=' 
WHERE 
  key_id = 'da950e325ead24e58b3b16094a67b1d85770f1c48221b6690259e5ccad663209' 
  AND (
    token = 'fFc/0SGMxp9tmbBKcuuM2vrztczGgm6jVS3JX7x2txw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052