UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HVZ8yUFInC8XkC9XBhh7X3UM/JK02Yzdx5A/uSXf9aM=' 
WHERE 
  key_id = '9685d79f90895873d975bed43b8ce61913236ceb5e3d85b69ab9317895af2ffe' 
  AND (
    token = 'HVZ8yUFInC8XkC9XBhh7X3UM/JK02Yzdx5A/uSXf9aM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033