UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z7AbZ60fPBIdaxdzXspgXgbREc2iFLfu8AVbA9UMzrc=' 
WHERE 
  key_id = '267451b0771e61e054f34c9d50bec1458f64575d63fae7b06945e2faf144eb9d' 
  AND (
    token = 'Z7AbZ60fPBIdaxdzXspgXgbREc2iFLfu8AVbA9UMzrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026