UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vMU76L+QcfczEBbvLzQKdxtLtA0C1cFtX5S+XiYgKz8=' 
WHERE 
  key_id = '2d03526607febfd4aae9caf3d4dfebd3eca8002d4276fbf86186d111215bfc4e' 
  AND (
    token = 'vMU76L+QcfczEBbvLzQKdxtLtA0C1cFtX5S+XiYgKz8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032