UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6kf396z9h9yRfQkGdNbq7robl6C6vRWwOwqlCL4oY6A=' 
WHERE 
  key_id = 'a04493568443f192c3c7b693de83866e61f3c6c1099ee0639b1b2677f2c2a327' 
  AND (
    token = '6kf396z9h9yRfQkGdNbq7robl6C6vRWwOwqlCL4oY6A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041